home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / mnp_c.zip / PORTIO.ASM < prev    next >
Assembly Source File  |  1990-05-16  |  2KB  |  93 lines

  1.     title    portio.asm
  2.     page    65,132
  3. ;==============================================================================
  4. ;
  5. ;                    The Microcom MNP Library
  6. ;                     (Microsoft C Version)
  7. ;
  8. ;---------------------------------------------------------------------------
  9. ;
  10. ;             PORTIO - MNP port input/output routines
  11. ;
  12. ;------------------------------------------------------------------------------
  13. ;
  14. ;    Modification History:
  15. ;
  16. ;    4/1/87 - Compuserve V1.0
  17. ;
  18. ;---------------------------------------------------------------------------
  19. ;
  20. ;    inp - input byte from port
  21. ;
  22. ;    synopsis: c = inp(port);
  23. ;
  24. ;    input:
  25. ;            int port;        port address
  26. ;
  27. ;    output:
  28. ;            int c:        returned data byte
  29. ;
  30. ;------------------------------------------------------------------------------
  31. ;
  32. ;    outp - output byte to port
  33. ;
  34. ;    synopsis: outp(port,c);
  35. ;
  36. ;            int port;    port address
  37. ;            int c;        byte to send
  38. ;
  39. ;==============================================================================
  40. ;
  41. _data    segment word public 'DATA'
  42. _data    ends
  43. dgroup    group    _data
  44.  
  45. _text    segment byte public 'CODE'
  46.     assume    cs:_text,ds:dgroup
  47.  
  48.     public    _inp
  49.     public    _outp
  50.  
  51. ;PUBLIC************************************************************************
  52. ;
  53. ;    _inp - read port
  54. ;
  55. ;******************************************************************************
  56.  
  57. _inp    proc    near
  58.  
  59.     push    bp
  60.     mov    bp,sp
  61.  
  62.     mov    dx,[bp+4]
  63.     in    al,dx
  64.     xor    ah,ah
  65.  
  66.     POP    BP
  67.     RET
  68.  
  69. _inp    endp
  70.     page
  71. ;PUBLIC************************************************************************
  72. ;
  73. ;    _outp - write port
  74. ;
  75. ;******************************************************************************
  76.  
  77. _outp    proc    near
  78.  
  79.     push    bp
  80.     mov    bp,sp
  81.  
  82.     mov    dx,[bp+4]
  83.     mov    ax,[bp+6]
  84.     out    dx,al
  85.  
  86.     pop    bp
  87.     ret
  88.  
  89. _outp    endp
  90.  
  91. _text    ends
  92.     end
  93.